(function(angular){
	'use strict';
	angular.module('fs.waf').controller('cda.acctType.viewController',viewController);
	viewController.$inject = ['$scope', 'Constants', 'layoutConfig', 'validatorConfig', 'gridService', 'authService', 'acctTypeService'];
	function viewController ($scope, Constants, layoutConfig, validatorConfig, gridService, authService, acctTypeService){
		var ctrl = this, acctTypeInfo = $scope.$stateParams.params;
		
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.init = function (){
			var params = {
					acctType : acctTypeInfo.acctType
			};
			ctrl.innerGridOptions = gridService.createInnerGridOptions($scope, ctrl.layoutConfig.formConfigs.general);
			authService.view(params).then(function(response) {
				acctTypeService.initOptionForSearch(ctrl).then(function(result){
					ctrl.acctType = response.data || acctTypeInfo;
					ctrl.isSystemAllowed = result.yesNoOptions;
				});
			}, angular.noop);
		};		
	}	
})(angular);